package com.itheima.sc.service.cms;


import cn.hutool.core.convert.Convert;
import com.itheima.sc.api.cms.SubjectApi;
import com.itheima.sc.pojo.cms.Subject;
import com.itheima.sc.vo.PageResult;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class SubjectService {

    @DubboReference
    private SubjectApi subjectApi;

    //根据专题名称分页获取商品专题
    public PageResult pageList(Map<String, String> param) {
        //获取map中的数据
        String keyword = param.get("keyword");
        Integer page = Convert.toInt(param.get("pageNum"));
        Integer pageSize = Convert.toInt(param.get("pageSize"));
        //发送请求
        return subjectApi.pageList(page,pageSize,keyword);
    }

    //查询所有
    public List<Subject> listAll() {
        return subjectApi.listAll();
    }
}
